import com.lucnn.diamond.spring.config.DIConfig;
import com.lucnn.diamond.spring.controller.BookController;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class IocTestDI {

    ApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfig.class);

    private void printBeans(ApplicationContext ctx){
        String[] names = ctx.getBeanDefinitionNames();
        for(String name:names){
            System.out.println(name);
        }
    }

    @Test
    public void testImport(){
        BookController bean = ctx.getBean(BookController.class);
        bean.print();
    }


}
